import axios from "axios"

export default {
    namespaced: true, // 命名空间
    state: {
        schoollist: []
    },
    mutations: {
        initschoollist(state, payload) {
            state.schoollist = payload
        }
    },
    actions: {
        initschoollistAsync({ commit }) {
            // 异步的请求
            axios.get('https://api.i-lynn.cn/college').then(res => {
                commit('initschoollist', res.data.data.list1)
            })

        }
    },
    getters: {
        filterschoollist(state) {
            return state.schoollist.filter(item => item.school_name.includes('北京'))
        }
    },
    modules: {

    }
}
